
/**
** \file       exec_list.c
**
** \brief      this function execute list rule
**
** \author     Ben M'rad Hanna, Laterem Hamza, Boillot Ulysse, De Olivera
**             Guillaume and Nguyen Viet Dung
**
** \version    1.0
**
** \date       28 November 2010
**
*/

#include "execution.h"

int             exec_list(s_list                *node)
{
  struct andor  *tmp_andor = NULL;
  int           ret;

  if (node != NULL)
    tmp_andor = node->andor;

  if (tmp_andor != NULL && tmp_andor->next == NULL)
    return (exec_andor(node->andor));
  else
  {
    while (tmp_andor != NULL)
    {
      ret = exec_andor(tmp_andor);

      if (ret != 0)
        return (1);

      tmp_andor = tmp_andor->next;
    }

    return (0);
  }
}
